home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT6 / INTLOCD.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-08-27  |  2.7 KB  |  84 lines

  1.  
  2. page    59,132
  3. ;
  4. ;                        Program   IntLocD
  5. ;                        ═════════════════
  6. ;                           Chapter 6
  7. ;
  8. ;                    Voronezh, 30 January 91
  9. ;                    ───────────────────────
  10. ;
  11. ;       This is a sample of an assembler program that uses a simple
  12. ;       DOS service.  It outputs  the  table of interrupts onto the
  13. ;       system  output  device  and reports where the corresponding
  14. ;       handler is located.  The letter B means BIOS, the  letter
  15. ;       D - DOS, the letter N - not set (dummy handler).
  16. ;
  17. .model small
  18. IntSeg  segment at 0
  19. IntVec  dw      512 dup (?)
  20. IntSeg  ends
  21. .stack
  22. .data
  23. tbint   db      16 dup ('xx-X ') , '$'
  24. HexSym  db      '0','1','2','3','4','5','6','7'
  25.     db      '8','9','A','B','C','D','E','F'
  26. NumInt  db      0
  27. NumIntL db      0
  28. .code
  29.     assume  es:IntSeg
  30.     mov     ax,@data
  31.     mov     ds,ax
  32.  
  33.     mov     ax,IntSeg
  34.     mov     es,ax
  35.  
  36.     mov     cx,16           ; Line counter
  37. Rows:                             ; Lines cycle starts here
  38.     push    cx              ; Save outward counter
  39.     mov     di,0            ; Counter within line
  40.     mov     cx,16           ; Columns cunter
  41.     mov     al,NumInt
  42.     mov     NumIntL,al
  43. Intrs:                          ;
  44.     mov     bh,0
  45.     mov     al,NumintL      ; Load interrupt number
  46.     mov     bl,al
  47.     shl     bx,1
  48.     shl     bx,1
  49.     mov     dx,IntVec[bx+2]
  50.     cmp     dx,0A000h       ; Compare it to the BIOS start address
  51.     ja      InBios          ; If DX is greater - handler is in BIOS
  52.     mov     tbint[di+3],'D' ; Set indicator 'DOS'
  53.     jmp     doneind         ; To the end of block
  54. InBios: mov     tbint[di+3],'B' ; Set indicator 'BIOS'
  55. DoneInd:                        ; This is the end of block
  56.  
  57.     cmp     byte ptr es:[bx],0CFh   ; First instruction IRET?
  58.     jne     PresHan                 ; If not - handler presented
  59.     mov     tbint[di+3],'N' ; Set indicator 'Not set'
  60. PresHan:                        ;
  61.     mov     ah,0            ; AL keeps the interrupt number
  62.     mov     dl,16           ; Prepare to converting AL to symbols
  63.     div     dl              ; AX / 16
  64.  
  65.     mov     bx,offset HexSym
  66.     xlat
  67.     mov     byte ptr tbint[di],al   ;    symbol into output line
  68.     mov     al,ah
  69.     xlat
  70.     mov     byte ptr tbint[di+1],al   ;    symbol into output line
  71.  
  72.     add     di,5            ; Next position in the line
  73.     add     NumIntL,16      ; Increase interrupt number
  74.     loop    Intrs           ; Next step - next interrupt
  75.     pop     cx              ; Restore cycle counter
  76.     mov     ah,09           ; Function 09 - output string
  77.     mov     dx,offset tbint ; Addres of string in DS:DX
  78.     int     21h             ; Output one string
  79.     inc     NumInt          ;
  80.     loop    Rows            ; Next step - next string
  81.     mov     ax,4C00h
  82.     int     21h
  83.     end                     ;
  84.